/**
 * Created by Lwang on 2017-03-30.
 */
import Util from "utils"
import $ from "jquery";

var productListCtrl = ['$scope', '$stateParams', '$state', '$location', '$http', '$timeout', '$rootScope', 'Http', function ($scope, $stateParams, $state, $location, $http, $timeout, $rootScope, Http) {
    $scope.productList = "";
    //置顶
    $(window).scrollTop(0);
    listAjax();
    function listAjax() {
        Http.request({
            url: Util.ajax.product,
            method: "POST",
            data: {
                page: 1,
                size: 10
            },
            success: function (res) {
                Http.handler(Util.merge(res, {
                    success: function (res) {
                        if (Util.getType(res.content) == "array") {
                            if (res.content.length > 0) {
                                $scope.productList = res.content;
                                console.log(res.content)
                            }
                        }
                    }
                }))

            },
            error: function (err) {

            }
        })
    }

}];
export {productListCtrl};